﻿/*The table dbo.BlogInstance referenced by class BlogInstance is not defined in the database.*/
Create Table dbo.BlogInstance (BlogInstanceId BigInt NOT NULL IDENTITY, Name NVarChar(255) NOT NULL, [Timestamp] rowversion,  constraint PK_BlogInstance primary key (BlogInstanceId));
go
/*The table dbo.BlogPost referenced by class BlogPost is not defined in the database.*/
Create Table dbo.BlogPost (BlogPostId BigInt NOT NULL IDENTITY, AuthorId VarChar(40), BlogInstanceId BigInt NOT NULL, DateCreated DateTime NOT NULL, AllowComments Bit NOT NULL, IsLive Bit NOT NULL, Title NVarChar(300) NOT NULL, Summary NVarChar(2000), Content NText, [Timestamp] rowversion, Category NVarChar(50), Tags NVarChar(1000), constraint PK_BlogPost primary key (BlogPostId));
go
/*The underlying foreign key for association BlogInstance_BlogPost on table BlogPost is not defined in the database.*/
Alter Table dbo.BlogPost add constraint FK_BlogPost_BlogInstance foreign key (BlogInstanceId) references dbo.BlogInstance (BlogInstanceId);
go
/*The table dbo.BlogComment referenced by class BlogComment is not defined in the database.*/
Create Table dbo.BlogComment (BlogCommentId BigInt NOT NULL IDENTITY, BlostPostId BigInt NOT NULL, AuthorName NVarChar(50) NOT NULL, DateCreated DateTime NOT NULL, AuthorUrl NVarChar(300), Approved Bit NOT NULL, Comment NVarChar(3000), [Timestamp] rowversion,  constraint PK_BlogComment primary key (BlogCommentId));
go
/*The underlying foreign key for association BlogPost_BlogComment on table BlogComment is not defined in the database.*/
Alter Table dbo.BlogComment add constraint FK_BlogComment_BlogPost foreign key (BlostPostId) references dbo.BlogPost (BlogPostId);
go
